<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:doc="http://www.brokenet.com/docs"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">
		<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">]]></xsl:text>
		<html>
			<head>
				<link type="text/css" href="../css/docs.css" rel="stylesheet" />
				<link rel="stylesheet" type="text/css" href="../css/xml2html.css" />
			</head>
			<body>
				<xsl:call-template name="copyright" />
				<xsl:apply-templates />
			</body>
		</html>
	</xsl:template>
	<xsl:template match="doc:topics|doc:docs">
		<div>
			<xsl:apply-templates />
		</div>
	</xsl:template>
	<xsl:template match="doc:catalogs">
		<div>
			<ul>
				<xsl:apply-templates />
			</ul>
		</div>
	</xsl:template>

	<xsl:template match="doc:catalog">
		<li>
			<a style="padding-right:6pt;">
				<xsl:value-of select="@hierarchyIndex" />
			</a>
			<a href="#{@href}">
				<xsl:value-of select="@title" />
			</a>
			<ul>
				<xsl:apply-templates />
			</ul>
		</li>
	</xsl:template>

	<xsl:template match="doc:topic">
		<div id="{@id}" class="topic">
			<h3>
				<a style="padding-right:6pt;">
					<xsl:value-of select="@hierarchyIndex" />
				</a>
				<a>
					<xsl:value-of select="@title" />
				</a>
			</h3>
			<div>
				<xsl:apply-templates />
			</div>
		</div>
	</xsl:template>

	<xsl:template match="doc:doc">
		<div>
			<xsl:if test="@class">
				<h5>
					<a href="{@apihref}" target="_blank"><xsl:value-of select="@class" /></a>
				</h5>
			</xsl:if>
			<xsl:apply-templates />
		</div>
	</xsl:template>

	<xsl:template match="doc:events">
		<h5>事件</h5>
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="doc:content">
		<p>
			<xsl:apply-templates />
		</p>
	</xsl:template>

	<xsl:template match="doc:important">
		<p class="important">
			重要:
			<xsl:apply-templates />
		</p>
	</xsl:template>
	<xsl:template match="doc:code">
		<div class="programlisting">
			<xsl:apply-templates />
		</div>
	</xsl:template>

	<xsl:template match="doc:link">
		<a href="{@href}">
			<xsl:value-of select="@title" />
		</a>
	</xsl:template>

	<xsl:template match="doc:xml">
		<div class="xml">
			<!-- -->
			<xsl:if test="@title">
				<div class="title"><xsl:value-of select="@title" /></div>
			</xsl:if>
			<xsl:value-of disable-output-escaping="yes" select="@html" />
		</div>
	</xsl:template>
	<!-- -->
	<xsl:template match="*|@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="*|@*|node()" />
		</xsl:copy>
	</xsl:template>

	<xsl:template match="doc:eventitems">
		<hr />
		<h5>事件</h5>
		<div class="pp eventitems">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<th>事件名称</th>
					<th>目标</th>
					<th>内容</th>
				</tr>
				<xsl:apply-templates />
			</table>
		</div>
	</xsl:template>

	<xsl:template match="doc:eventitem">
		<tr>
			<td>
				<a href="{@href}">
					<xsl:value-of select="@title" />
				</a>
			</td>
			<td>
				<xsl:value-of select="@target" />
			</td>
			<td>
				<xsl:value-of select="@content" />
			</td>
		</tr>
	</xsl:template>

	<xsl:template match="doc:img">
		<div class="img">
			<xsl:copy>
				<xsl:apply-templates select="@*" />
			</xsl:copy>
		</div>
	</xsl:template>

	<xsl:template match="doc:examples">
		<hr />
		<h5>示例:</h5>
		<ul>
			<xsl:for-each select="*">
				<li>
					<xsl:apply-templates select="." />
				</li>
			</xsl:for-each>
		</ul>
	</xsl:template>

	<xsl:template match="doc:example">
		<a href="{@url}" target="_blank">
			<xsl:value-of select="@title" />
		</a> , 
		<a href="{@fileUrl}" target="_blank">
			source code
		</a>
	</xsl:template>

	<xsl:template match="doc:element">
		<hr />
		<h5>
			Xml NameSpace:
			<xsl:value-of select="@xmlns" />
		</h5>
		<h5>
			Xml LocalName:
			<a style="color:#197d4d;">
				<xsl:value-of select="@localName" />
			</a>
		</h5>
		<div class="pp">
			<xsl:apply-templates />
		</div>
	</xsl:template>

	<xsl:template match="doc:defaultlayout">
		<hr />
		<h5>
			Default Layout
		</h5>
		<p>
			<a href="{@href}">
				<xsl:value-of select="@title" />
			</a>
		</p>
	</xsl:template>

	<xsl:template match="doc:attributes">
		<div class="attributes">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<th>属性名</th>
					<th>默认</th>
					<th>use</th>
					<th>类型</th>
					<th>说明</th>
				</tr>
				<xsl:apply-templates />
			</table>
		</div>
	</xsl:template>

	<xsl:template match="doc:attribute">
		<tr>
			<td style="color : #7f00ab">
				<xsl:value-of select="@name" />
			</td>
			<td>
				<xsl:value-of select="@default" />
			</td>
			<td>
				<xsl:value-of select="@use" />
			</td>
			<td>
				<a href="{@href}">
					<xsl:value-of select="@title" />
				</a>
			</td>
			<td class="content">
				<xsl:apply-templates />
			</td>
		</tr>
	</xsl:template>

	<xsl:template match="doc:xui-component-developer">
		<h5>开发者</h5>
		<div>
			如果您想要开发Brokenet-XUI的组件，猜测您会对以下内容感兴趣
		</div>
		<div>
			<xsl:apply-templates />
		</div>
	</xsl:template>

	<xsl:template match="doc:xui-for-developer">
		<div style="padding:10px;">如果您对Brokenet-XUI组件的开发不感兴趣，则您可以忽略以下内容</div>
	</xsl:template>
	
	<xsl:template match="doc:to-be-implement">
		<div style="padding:10px;">等待实现中．．．</div>
	</xsl:template>
	
	<xsl:template match="doc:to-be-write">
		<div style="padding:10px;">等待文档完善．．．</div>
	</xsl:template>

	<xsl:template name="copyright">
		<div>
			<h3>Brokenet XUI Framework</h3>
			<h4>Reference Documentation</h4>

			<h4>1.0</h4>
			<p>
				Copyright © 2012-2013 Feng Jianguang http://www.brokenet.com
			</p>
			<p>
				Copies of this document may be made for your own use
				and for
				distribution
				to others, provided that you do not charge any
				fee for
				such copies
				and further provided that each copy contains this
				Copyright Notice,
				whether distributed in print or electronically.
			</p>
		</div>

	</xsl:template>
</xsl:stylesheet>